home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
005
/
miscstat.arc
/
EXPREG.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-04-25
|
1KB
|
49 lines
1 'EXPonential REGression
2 KEY OFF:SCREEN 0,1,0:WIDTH 40:COLOR 15,1,9:CLS
10 PRINT "EXPONENTIAL REGRESSION"
20 PRINT
30 PRINT "NUMBER OF KNOWN POINTS";
40 INPUT N:IF N=0 THEN 410
42 IF N<1 THEN 30
50 J = 0
60 K = 0
70 L = 0
80 M = 0
90 R2 = 0
100 FOR I = 1 TO N
110 PRINT "X,Y OF POINT";I;
120 INPUT X,Y
130 Y = LOG (Y)
140 J = J + X
150 K = K + Y
160 L = L + X ^ 2
170 M = M + Y ^ 2
180 R2 = R2 + X * Y
190 NEXT I
200 B = (N * R2 - K * J) / (N * L - J ^ 2)
210 A = (K - B * J) / N
220 PRINT
230 PRINT "A =" EXP (A)
240 PRINT "B ="B
250 J = B * (R2 - J * K / N)
260 M = M - K ^ 2 / N
270 K = M - J
280 PRINT
290 R2 = J / M
300 PRINT "COEFFICIENT OF DETERMINATION (R^2): ";R2
310 PRINT "COEFFICIENT OF CORRELATION: "; SQR (R2)
320 PRINT "STANDARD ERROR OF ESTIMATE: "; SQR ( ABS (K / (N - 2)))
330 PRINT
340 PRINT "INTERPOLATION: (ENTER 0 TO END PROGRAM)"
350 INPUT "X = ",X
370 IF X = 0 THEN 410
380 PRINT "Y = "; EXP (A) * EXP (B * X)
390 PRINT
400 GOTO 350
410 PRINT:LOCATE 24,1:PRINT"PRESS <SPACE> TO RUN AGAIN";
420 LOCATE 25,1:PRINT"PRESS <ESC> TO EXIT";
430 K$=INKEY$:IF K$="" THEN 430
440 IF K$=" " THEN RUN
450 IF K$<>CHR$(27) THEN 430
10000 RUN"EXPREG